package com.mspbots.attendance.controller;


import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.mspbots.attendance.model.TenantUserConfiguration;
import com.mspbots.attendance.service.TenantUserConfigService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import java.util.concurrent.Callable;

/**
 * <p>
 *
 * </p>
 *
 * @author Jun Zhou
 * @since 2019-06-24
 */
@RestController
@RequestMapping("{tenant}/user-configuration")
public class TenantUserConfigurationController {

    @Autowired
    private TenantUserConfigService service;

    /**
     * 分页获取正在work_time状态的配置
     *
     * @param page
     * @param query
     * @return
     */
    @GetMapping(path = "/workTimePage")
    public Callable configPage(Page<TenantUserConfiguration> page, TenantUserConfiguration query) {
        return () -> service.workTimePage(page, query);
    }

//    @GetMapping(path = "/workTimeList")
//    public Callable workTimeList(TenantUserConfiguration query) {
//        return () -> service.workTimeList(query);
//    }
//
//    @GetMapping(path = "/keyword/{keyword}")
//    public Callable selectByTenantUserId(@RequestParam("tenantId") Long tenantId,
//                                         @RequestParam("tenantUserId") Long tenantUserId,
//                                         @PathVariable String keyword) {
//        TenantUserConfiguration tenantUserConfiguration = new TenantUserConfiguration();
//        tenantUserConfiguration.setTenantId(tenantId);
//        tenantUserConfiguration.setTenantUserId(tenantUserId);
//        tenantUserConfiguration.setKeyword(keyword);
//        return () -> service.findByKeyword(tenantUserConfiguration);
//    }
//
//    @PostMapping(path = "/save")
//    public Callable saveOrUpdate(@RequestBody TenantUserConfiguration dto) {
//        return () -> service.insertOrUpdate(dto);
//    }
//
//    @PostMapping(path = "/saveBatch")
//    public Callable saveOrUpdateBatch(@RequestBody List<TenantUserConfiguration> list) {
//        return () -> service.insertOrUpdateBatch(list);
//    }
//
//    @GetMapping(path = "/deleteWorkTime")
//    public Callable deleteWorkTime(@RequestParam("userList") List<Long> userList){
//        return () -> service.deleteWorkTime(userList);
//    }
}

